import random
from mimesis import Person,Address,Code
def telephone():
    p = Person()

    # 所有的头信息添加上来
    for i in range(100):
        phon = [133, 149, 153, 173, 177, 180, 181, 189, 191, 199, 130, 131, 132, 145, 155, 156, 166, 171, 175, 176, 185,
                186, 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 172, 178, 182, 183, 184, 187, 188, 198]
        phone = str(random.choice(phon)) + "".join(random.choice("0123456789") for i in range(8))
        username = p.username('Ud')
        with open('phone.csv',mode='a+',encoding='utf8') as f:
            f.write(phone + ','+ username + '\n')
    return phone
# phone = telephone()
# print(phone)

def address():
    add = Address(locale='zh')
    # print(add.address())
    # print(add.province())
    # print(add.city())
    # print(add.postal_code())
    # print(add.region())
    for i in range(100):
        with open('address.csv',mode='a+',encoding='utf8') as f:
            f.write(add.address() + ',' + add.province() + ',' + add.city() + ',' + add.postal_code() + ',' + add.region() + '\n')

address()